//一般直接写在一个js文件中
layui.use(['element','form'],function () {
    var $ = layui.jquery
        , layer = layui.layer,
        form = layui.form;
    form.on('submit(sb)', function (data) {
        var parentId = data.field.parentId;
        var name = data.field.name;
        var isNursingDepartment = data.field.isNursingDepartment;
        parent.layer.close(parent.oo);
        $.ajax({
            url: '/department/save',
            data:{"parentId":parentId,"name":name,"isNursingDepartment":isNursingDepartment},
            type: 'post',
            dataType: 'json',
            async: false,
            success: function (rs) {
                if (rs.code === 200) {
                    parent.layer.msg(rs.message);
                    parent.location.reload();
                } else {
                    layer.msg(rs.message);
                }
            }
        });
        return false;
    });
});